feat!: remove NETNA_CONFIG and default ABIs to testnet#12
Conversation
This commit modifies the README and various example scripts to replace instances of NETNA_CONFIG with TESTNET_CONFIG, ensuring consistency in the configuration used for test network operations. This change enhances clarity and aligns with the intended usage of the Decibel library.
There was a problem hiding this comment.
Pull request overview
Removes the legacy Netna (chain id 208) configuration/ABI path and changes the SDK’s default ABI selection and unknown chain_id fallback to Aptos testnet, updating exports, docs, examples, and tests accordingly.
Changes:
- Removed
NETNA_CONFIGfrom public exports andNAMED_CONFIGS; adjusted gas station defaults to drop Netna-specific URL handling. - Updated ABI registry/generation logic to remove chain id 208 and default/fallback to
testnet.json; deleted the Netna ABI bundle. - Migrated all README/examples from
NETNA_CONFIGtoTESTNET_CONFIGand added a runnablemarket_maker_bot.pyexample.
Reviewed changes
Copilot reviewed 73 out of 73 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/abi/test_registry.py | Updates ABI registry tests for testnet default/fallback behavior. |
| src/decibel/abi/json/netna.json | Removes the Netna ABI JSON bundle. |
| src/decibel/abi/generate.py | Removes Netna filename mapping; keeps testnet/mainnet mapping and default naming. |
| src/decibel/abi/_registry.py | Drops chain id 208 handling; defaults and unknown chain fallback now use testnet ABIs. |
| src/decibel/_fee_pay.py | Removes Netna-specific gas station URL default branch. |
| src/decibel/_constants.py | Removes NETNA_CONFIG constant and NAMED_CONFIGS["netna"] entry. |
| src/decibel/init.py | Removes NETNA_CONFIG from top-level exports. |
| README.md | Updates documentation examples and config list to use TESTNET_CONFIG instead of NETNA_CONFIG. |
| examples/write/withdraw.py | Migrates example to TESTNET_CONFIG. |
| examples/write/withdraw_from_vault.py | Migrates example to TESTNET_CONFIG. |
| examples/write/update_tp_sl_order.py | Migrates example to TESTNET_CONFIG and updates address derivations. |
| examples/write/trigger_matching.py | Migrates example to TESTNET_CONFIG and updates address derivations. |
| examples/write/revoke_delegation.py | Migrates example to TESTNET_CONFIG. |
| examples/write/revoke_builder_fee.py | Migrates example to TESTNET_CONFIG. |
| examples/write/place_twap_order.py | Migrates example to TESTNET_CONFIG. |
| examples/write/place_tp_sl_for_position.py | Migrates example to TESTNET_CONFIG and updates address derivations. |
| examples/write/place_stop_order.py | Migrates example to TESTNET_CONFIG. |
| examples/write/place_order_with_tp_sl.py | Migrates example to TESTNET_CONFIG. |
| examples/write/place_market_order.py | Migrates example to TESTNET_CONFIG. |
| examples/write/place_limit_order.py | Migrates example to TESTNET_CONFIG. |
| examples/write/place_bulk_orders.py | Migrates example to TESTNET_CONFIG. |
| examples/write/market_maker_bot.py | Adds a reference market maker bot example using named configs and read/write clients. |
| examples/write/deposit.py | Migrates example to TESTNET_CONFIG. |
| examples/write/deposit_to_vault.py | Migrates example to TESTNET_CONFIG and updates subaccount derivation inputs. |
| examples/write/delegate_vault_actions.py | Migrates example to TESTNET_CONFIG. |
| examples/write/delegate_trading.py | Migrates example to TESTNET_CONFIG and updates subaccount derivation inputs. |
| examples/write/deactivate_subaccount.py | Migrates example to TESTNET_CONFIG. |
| examples/write/create_vault.py | Migrates example to TESTNET_CONFIG. |
| examples/write/create_subaccount.py | Migrates example to TESTNET_CONFIG. |
| examples/write/configure_market_settings.py | Migrates example to TESTNET_CONFIG and updates address derivations. |
| examples/write/cancel_twap_order.py | Migrates example to TESTNET_CONFIG and updates address derivations. |
| examples/write/cancel_tp_sl_order.py | Migrates example to TESTNET_CONFIG and updates address derivations. |
| examples/write/cancel_order.py | Migrates example to TESTNET_CONFIG. |
| examples/write/cancel_order_by_client_id.py | Migrates example to TESTNET_CONFIG. |
| examples/write/cancel_bulk_order.py | Migrates example to TESTNET_CONFIG. |
| examples/write/approve_builder_fee.py | Migrates example to TESTNET_CONFIG. |
| examples/write/activate_vault.py | Migrates example to TESTNET_CONFIG. |
| examples/read/ws/subscribe_user_trade_history.py | Migrates WS example to TESTNET_CONFIG. |
| examples/read/ws/subscribe_user_positions.py | Migrates WS example to TESTNET_CONFIG. |
| examples/read/ws/subscribe_user_order_history.py | Migrates WS example to TESTNET_CONFIG. |
| examples/read/ws/subscribe_user_open_orders.py | Migrates WS example to TESTNET_CONFIG. |
| examples/read/ws/subscribe_user_notifications.py | Migrates WS example to TESTNET_CONFIG. |
| examples/read/ws/subscribe_user_bulk_orders.py | Migrates WS example to TESTNET_CONFIG. |
| examples/read/ws/subscribe_user_active_twaps.py | Migrates WS example to TESTNET_CONFIG. |
| examples/read/ws/subscribe_market_trades.py | Migrates WS example to TESTNET_CONFIG. |
| examples/read/ws/subscribe_market_price.py | Migrates WS example to TESTNET_CONFIG. |
| examples/read/ws/subscribe_market_depth.py | Migrates WS example to TESTNET_CONFIG. |
| examples/read/ws/subscribe_candlesticks.py | Migrates WS example to TESTNET_CONFIG. |
| examples/read/ws/subscribe_all_market_prices.py | Migrates WS example to TESTNET_CONFIG. |
| examples/read/ws/subscribe_account_overview.py | Migrates WS example to TESTNET_CONFIG. |
| examples/read/list_market_addresses.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_user_twap_history.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_user_trade_history.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_user_subaccounts.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_user_positions.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_user_order_history.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_user_open_orders.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_user_funding_history.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_user_fund_history.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_user_bulk_orders.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_user_active_twaps.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_trading_points.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_portfolio_chart.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_market_trades.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_market_price.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_market_depth.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_market_contexts.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_leaderboard.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_delegations.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_candlesticks.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_all_markets.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_all_market_prices.py | Migrates read example to TESTNET_CONFIG. |
| examples/read/get_account_overview.py | Migrates read example to TESTNET_CONFIG. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This commit improves the logging format for margin usage in the market maker bot and updates the Network and CompatVersion classes to inherit from StrEnum for better string representation. These changes enhance code clarity and maintainability.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 73 out of 73 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/decibel/abi/generate.py:53
get_abi_filename()now falls back tof"{config.network.value}.json"for non-testnet/mainnet configs. Since bothLOCAL_CONFIGandDOCKER_CONFIGuseNetwork.CUSTOM, this will generate the same filename (custom.json) and can overwrite outputs when fetching multiple networks. Consider special-casingLOCAL_CONFIG/DOCKER_CONFIG(e.g.,local.json/docker.json) or incorporating a stable discriminator (like the named config key or chain_id) into the filename.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 72 out of 72 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
src/decibel/abi/generate.py:52
get_abi_filename()derives the output name fromconfig.network.value, which means bothLOCAL_CONFIGandDOCKER_CONFIG(bothNetwork.CUSTOM) will write to the samecustom.jsonand overwrite each other when fetching multiple networks. Consider basing the filename on the selected named config key (e.g., "local.json"/"docker.json") or passing the CLI network label intofetch_all_abis()so each run produces a distinct artifact.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def test_returns_testnet(self) -> None: | ||
| data = get_default_abi_data() | ||
| assert "netna" in data.fullnode_url | ||
| assert "testnet" in data.fullnode_url |
There was a problem hiding this comment.
test_returns_testnet only checks that "testnet" appears in fullnode_url. Since ABIData exposes a network field, it would be more direct (and less brittle than substring matching) to assert data.network == "testnet" here too, consistent with test_testnet_chain_id.
| def get_abi_data(chain_id: int | None) -> ABIData: | ||
| if chain_id == CHAIN_ID_MAINNET: | ||
| return _load_abi_json("mainnet.json") | ||
| elif chain_id == CHAIN_ID_NETNA: | ||
| return _load_abi_json("netna.json") | ||
| elif chain_id == CHAIN_ID_TESTNET: | ||
| return _load_abi_json("testnet.json") | ||
| else: | ||
| warnings.warn( | ||
| f"Unknown chain_id {chain_id}, falling back to NETNA ABIs", | ||
| f"Unknown chain_id {chain_id}, falling back to TESTNET ABIs", | ||
| stacklevel=2, | ||
| ) | ||
| return _load_abi_json("netna.json") | ||
| return _load_abi_json("testnet.json") |
There was a problem hiding this comment.
get_abi_data() accepts chain_id: int | None, but None currently goes through the "Unknown chain_id None" warning path. If None is meant to indicate "use default", consider handling chain_id is None explicitly (delegating to get_default_abi_data() without warning) and reserving the warning for truly unknown integer chain IDs.
Summary
This PR removes the legacy Netna (chain id 208) deployment path, deletes the Netna ABI bundle, and aligns the SDK’s default ABI selection and unknown-
chain_idfallback behavior with Aptos testnet (testnet.json). Public configuration exports dropNETNA_CONFIGin favor ofTESTNET_CONFIG, with README and all read/write/WebSocket examples updated accordingly. It also adds a runnableexamples/write/market_maker_bot.pyreference implementation and updates ABI registry tests.Changes
NETNA_CONFIGfrom exports and migrateNAMED_CONFIGSusage consistently to testnet.CHAIN_ID_NETNAhandling; default ABI data and warnings now fall back to testnet instead of Netna.src/decibel/abi/json/netna.json.get_abi_filenamemapping to match the new configuration surface.chain_id == 208.NETNA_CONFIGwithTESTNET_CONFIGacross examples; addmarket_maker_bot.py.tests/abi/test_registry.pyfor the new default/fallback behavior.Motivation
Netna-specific ABIs and configuration increase maintenance burden and confuse onboarding relative to the current Aptos testnet deployment model. Centralizing on
TESTNET_CONFIGreduces ambiguity and keeps defaults aligned with supported environments.Verification
tests/abi/test_registry.py).Breaking changes
NETNA_CONFIGis removed fromdecibelexports.